<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fn () {
            // 记忆功能
            let sum = 0;
            return function getSum(num) {
                sum += num;
                return sum;
            };
        }
        const getSum = fn();
        const res1 = getSum(10);
        const res2 = getSum(5);
        const res3 = getSum(5);
        console.log(res1, res2, res3);
    </script>
</body>
</html>